package com.youkeyi.ddy.cloud.common.api.application.system.organization;

import com.youkeyi.ddy.cloud.common.api.application.system.organization.dto.SystemOrganizationDetailCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.system.organization.dto.SystemOrganizationListCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.system.organization.param.*;
import com.youkeyi.ddy.cloud.common.response.ResponseContent;
import io.swagger.annotations.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 系统组织
 *
 * @Organizationor liuxiawang
 * @Date 5/24/22 10:36 PM
 * @Location shenzhen.china
 */
@Api(tags = {"【SYSTEM】organization management"})
@RestController
@FeignClient(value = "YOUKEYI-DDY-CLOUD-APPLICATION-SYSTEM", fallback = SystemOrganizationCloudServiceFallback.class)
@RequestMapping("/system/organization")
public interface SystemOrganizationCloudService {

    // 查询组织列表
    @ApiOperation(value = "Query System Organization List", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.list")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemOrganizationListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query System Organization List", dataType = "SystemOrganizationListCloudParam", dataTypeClass = SystemOrganizationListCloudParam.class),
    })
    @GetMapping
    public abstract SystemOrganizationListCloudDto list(SystemOrganizationListCloudParam param);

    // 查询主体及关联主体下的所有组织，当前主体下的组织放在首位
    @ApiOperation(value = "Query Mapping Organization List", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.mappingList")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemOrganizationListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query System Organization List", dataType = "SystemOrganizationListCloudParam", dataTypeClass = SystemOrganizationListCloudParam.class),
    })
    @GetMapping("/mapping/list")
    public abstract SystemOrganizationListCloudDto mappingList(SystemOrganizationListCloudParam param);

    // 查询全部组织列表
    @ApiOperation(value = "Query System Organization All", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.all")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemOrganizationListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query System Organization All"),
    })
    @GetMapping("/all")
    public abstract SystemOrganizationListCloudDto all();

    // 查询组织详情
    @ApiOperation(value = "Query System Organization Detail", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.detail")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemOrganizationDetailCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "organizationPrimaryKey", paramType = "path", value = "Param of Query System Organization Detail", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping("/{organizationPrimaryKey}")
    public abstract SystemOrganizationDetailCloudDto detail(@PathVariable("organizationPrimaryKey") String organizationPrimaryKey);

    // 创建组织
    @ApiOperation(value = "Create System Organization", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.create")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Create System Organization", dataType = "SystemOrganizationCreateCloudParam", dataTypeClass = SystemOrganizationCreateCloudParam.class),
    })
    @PostMapping("/create")
    public abstract ResponseContent create(@RequestBody SystemOrganizationCreateCloudParam param);


    // 编辑组织
    @ApiOperation(value = "Update System Organization", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.update")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Update System Organization", dataType = "SystemOrganizationUpdateCloudParam", dataTypeClass = SystemOrganizationUpdateCloudParam.class),
    })
    @PatchMapping("update")
    public abstract ResponseContent update(@RequestBody SystemOrganizationUpdateCloudParam param);


    // 删除组织
    @ApiOperation(value = "Delete System Organization", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.system.organization.SystemOrganizationCloudService.delete")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Delete System Organization", dataType = "SystemOrganizationDeleteCloudParam", dataTypeClass = SystemOrganizationDeleteCloudParam.class),
    })
    @DeleteMapping("/delete")
    public abstract ResponseContent delete(SystemOrganizationDeleteCloudParam param);

}
